<!--页面按键事件-->
	<!-- 配置文件 -->
    <script type="text/javascript" src="/assets/js/ueditor/ueditor.config.js"></script>
    <!-- 编辑器源码文件 -->
    <script type="text/javascript" src="/assets/js/ueditor/ueditor.all.js"></script>

	<link href="/assets/js/ueditor/themes/default/css/ueditor.css" type="text/css" rel="stylesheet">
<script language="javascript">
	var editor = new UE.ui.Editor({zIndex : 90000, toolbars: [
		['source', 'undo', 'redo','bold', 'italic', 'underline', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'selectall', 'cleardoc']
	]});
	editor.render("description");
</script>

<SCRIPT type="text/javascript">
	function pannelMgr(id){
		$("#main_pannel_ul>li").attr("class","nav_tapIthems");
		$("#mainDiv>div").css("display","none");
		$("#"+id+"_div").css("display","block");
		$("#"+id+"_li").addClass("cur");
		
	}
	var ztree;
	//选择用户
	$("#newreport").on("click",function(){
		pannelMgr('authselect');
		//绑定提交权限,用户和组织append到权限中
		$("#btnSubmit").click(function(){
			var userids ="";
			$("div#authselect_div input:checkbox[name='userownerids']:checked").each(function(index, element) {
				if(userids.length!=0){
					userids +=",";
				}
				userids += this.value;
			});
			var roleids = "";
			var checkeds = ztree.getCheckedNodes();
			for(var i=0;i<checkeds.length;i++){
				if(checkeds[i].id&&checkeds[i].id != "0"){
					roleids += checkeds[i].id+",";
				}
			}
			loadURL("/${orgi}/user/report/${tabid}/${dicid!''}/${report.id}/roleditdo.html?isDic=0&isReport=1&userids="+userids+"&roleids="+roleids,".d-content",function(){
				pannelMgr('level');
			});	
			return false;
		});
		
		$("#btnCancel").click(function(){
			pannelMgr('level');
			return false;
		});
		
	});
	function selUserGroupclose(){
		var subVal = "" ;
		$('input[name="userid"]:checked').each(function(){
			if(subVal!=""){
				subVal += "," ;
			}
			subVal += $(this).val();
		}); 
		loadURL('/${orgi}/user/report/${tabid}/authorize.html?reportid=${report.id!""}&dicid=${dicid!''}&authexpress='+encodeURIComponent(subVal),'#perdiv' , function(){
			 var dialog = art.dialog({id: 'selUserGroup',title: false});
			dialog.close();
		})	; 		
	}
	function openUserGroup(){
		var userDialog = art.dialog({
		    title: '选择用户',
		    id:'selUserGroup',
		    content: '<div id ="userDialog" class="conTop" style="padding:0;margin:0"><img src="/assets/images/loading.png" width="35" height="35" alt=""><h2>页面正在载入，请稍候......</h2></div>',
		    width: 350,
		    padding:'0',
		    initialize: function () {
		    	var currentDialog = this;
				$.ajax({
					url:"/${orgi}/user/report/${tabid}/organ/selUser.html?sub=true",
					cache:false,
					success: function(data){
						$("#userDialog").empty().html(data);
						//userDialog.content(data);
					},
					error:  function(xhr, type, s){	
						if(xhr.getResponseHeader("emsg")){
							art.alert(xhr.getResponseHeader("emsg"));
						}
					}
				}).done(function(){
				});
		    	//loadURL("/${orgi}/user/report/${tabid}/role/selUser.html" , "#tempdiv" , function(){} );
		    }
		});
	}
	function submitForm(){
		if($("#report_name").val().length<=0){
			pannelMgr('proper');
		}
		$("#propertiesForm").submit();
		
	}
</SCRIPT>
<div class="artCon">
	<#include "/pages/user/report/roleselect.html"/>	
	<div class="middleArt" style="width:750px">
	<form class="form-horizontal" id="propertiesForm" action="/${orgi}/user/report/${tabid}/${dicid!''}/reportedito.html" data-toggle="form" method="post">
		<input type="hidden" value="${report.id}" name="id"/>
		<div class="artMain">
			<div class="rs_layout_center">
				<div class="rs_layout">
				
					<div class="rs_layout_top">
						<ul id="main_pannel_ul" class="nav_tapWrap">							
							<!-- 1读/2编辑/3设置策略/4设计/5执行/6遍历 -->
							<li id="proper_li" onclick="pannelMgr('proper')" class="nav_tapIthems cur">基本信息</li>
							<li id="description_li" onclick="pannelMgr('description')" class="nav_tapIthems">描述</li>
							<#if report.isAllow('0',user) == true>
								<li id="level_li" onclick="pannelMgr('level')" class="nav_tapIthems">权限</li>
							</#if>
							<#if report.isAllow('2',user) == true>
								<li id="publish_li" onclick="pannelMgr('publish')" class="nav_tapIthems">发布</li>
							</#if>
							<#if  report.isAllow('3',user) == true>
								<li id="tactics_li" onclick="pannelMgr('tactics')" class="nav_tapIthems">策略</li>
							</#if>
								<li id="authselect_li" style="display:none" onclick="pannelMgr('authselect')" class="nav_tapIthems">选择用户</li>
							
						</ul>
					</div>
					<div id="mainDiv" class="rs_layout_center">
							<div id="proper_div" style="padding:10px;">
								<table class="data_table_1">
									<tr>
										<th>报表名称：</th>
										<td><input id="report_name" name="name" type="text" class="required span2" minlength="3" value="${report.name!''}"><span class="help-inline"></span><i class="inputip">*</i></td>
										<th>创建时间：</th>
										<td>${report.createtime?string("yyyy-MM-dd HH:mm:ss")}</td>
									</tr>
									<tr>
										<th>创建人：</th>
										<td><a href="#" class="tblinks">${report.username!''}（${report.useremail!''}）</a></td>
										<th>修改时间：</th>
										<td>${report.updatetime?string("yyyy-MM-dd HH:mm:ss")}</td>
									</tr>
									<tr>
										<th>类型：</th>
										<td>
											<!--  
											<label class="radio inline"><input type="radio" <#if report.rolename??&&report.rolename=='0'>checked="checked"</#if> value="0" name="rolename">自助查询</label>
											<label class="radio inline"><input type="radio" <#if report.rolename??&&report.rolename=='1'>checked="checked"</#if> value="1" name="rolename">自定义报表</label>
											<label class="radio inline"><input type="radio" <#if report.rolename??&&report.rolename=='dashboard'>checked="checked"</#if> value="dashboard" name="rolename">仪表盘</label>
											-->
											
											<input type="hidden" name="rolename" value="${report.rolename!''}">
											<#if report.rolename?? && report.rolename == 'dashboard'>仪表盘<#else>自助查询</#if>

										</td>
										<th>报表位置：</th>
										<td>${report.reportpackage!''}</td>
									</tr>
									<tr>
										<th>联系人：</th>
										<td><input name="username" type="text" class="span2" value="${report.username!''}"></td>
										<th>代码：</th>
										<td><input name="title" type="text" class="span2" value="${report.title!''}"></td>
									</tr>
									
								</table>
							</div>
							
							<div id="description_div" style="padding:10px; display: none;">
								<table class="data_table_1">
									<tr>
										<th style="vertical-align:top; padding-top:20px; padding-bottom:20px; line-height:42px; border-top: dashed 1px #ccc">报表说明：</th>
										<td style=" padding-top:10px; padding-bottom:10px; border-top: dashed 1px #ccc;" colspan="3"><textarea name="description" id="description" style="width:100%; height:150px; resize:none;" id="" cols="30" rows="10">${report.description!''}</textarea></td>
									</tr>
								</table>
							</div>
							
							<div id="level_div" style="padding:10px;min-height:130px; display: none;">
								<p>指定报表或目录的访问权限。默认情况下，报表或目录从上级目录继承访问权限。您可以使用为此配置</p>
								<div class="check_top">
									  <p><label>
									  	<input type="checkbox" name="useacl" value="true" <#if report.useacl?? && report.useacl == 'true'>checked="checked"</#if>/>覆盖从父条目继承的访问权限  
									  	<i class="tbControlIcon icons_user" style="padding-top: 4px;"></i>
									  	<a title="添加授权对象" href="javascript:openUserGroup()">选择组或用户</a>
									  </label>  </p>
								</div>
								<div style="width: 100%;height:280px;">
								<div class="tableScrollWrap" style="width:100%;overflow-x: hidden;">
									<div class="check_box_con" style="width:100%;overflow-x:hidden;margin-left:0px;" id="perdiv">
										<#include "reportauthorize.html"/>
									</div>
								</div>
								</div>
							</div>
										
							<div id="publish_div" style="padding:10px;min-height:130px; display: none;">
							<table class="data_table_1" style="width:750px">
									<tr>
										<th>发布选项：</th>
										<td>
											<label class="radio inline"><input type="radio" checked="checked" value="no" name="publishType">不发布</label>
											<label class="radio inline"><input onclick="document.getElementById('tr_url').style.visibility='hidden';$('#url').removeClass('required');" type="radio" value="local" name="publishType">本地发布</label>
											<label class="radio inline"><input onclick="document.getElementById('tr_url').style.visibility='visible';$('#url').addClass('required');" type="radio" value="remote" name="publishType">远程发布</label>
										</td>
										<th>&nbsp;</th>
										<td>&nbsp;</td>
									</tr>
									<tr>
										<th>&nbsp;</th>
										<td>
											<label class="radio inline"><input type="radio" checked="checked"  value="yes" name="isRecover">覆盖</label>
											<label class="radio inline"><input type="radio" value="no" name="isRecover">创建新版本</label>
										</td>
										<th>
											&nbsp;
										
										</th>
										<td>&nbsp;</td>
									</tr>
									<tr style="visibility: hidden;" id="tr_url">
										<th>服务器地址：</th>
										<td>
											<input type="text" name="url" id="url" maxlength="200" value="" class="span3"><i class="inputip">*</i>
										</td>
										<th>
											&nbsp;
										
										</th>
										<td>&nbsp;</td>
									</tr>
									
								</table>
							</div>
							<div id="tactics_div" style="padding:10px; min-height:130px;display: none;">
								<table class="data_table_1" style="width:750px">
									
									<tr>
										<th>缓存设置：</th>
										<td>
											<label class="radio inline"><input type="radio" <#if report.cache?? && report.cache==false><#else>checked="checked"</#if> value="1" name="cache">启用</label>
											<label class="radio inline"><input type="radio" <#if report.cache?? && report.cache==false>checked="checked"</#if> value="0" name="cache">不启用</label>
											
										</td>
										<th>
											&nbsp;
										
										</th>
										<td>&nbsp;</td>
									</tr>
									<tr>
										<th>报表修改为：</th>
										<td>
											<label class="radio inline"><input type="radio" <#if report.status?? && report.status =='unavailable'><#else>checked="checked"</#if> value="available" name="status">可用</label>
											<label class="radio inline"><input type="radio" <#if report.status?? && report.status=='unavailable'>checked="checked"</#if> value="unavailable" name="status">不可用</label>
										</td>
										<th>
											&nbsp;
										
										</th>
										<td>&nbsp;</td>
									</tr>
									<tr>
										<th></th>
										<td>
											<label class="radio inline"><input type="checkbox" <#if report.extparam?? && report.extparam=='true'>checked="checked"</#if> value="true" name="extparam">默认使用Player执行报表</label>
											<label class="radio inline" style="margin-left: 20px;"><input type="checkbox" <#if report.objectcount?? && report.objectcount==1>checked="checked"</#if> value="1" name="objectcount">默认打开报表不加载数据</label>
											<label class="radio inline" style="margin-left: 20px;"><input type="checkbox" <#if report.html?? && report.html=="1">checked="checked"</#if> value="1" name="html">允许移动端匿名访问</label>
										</td>
										<th>
											&nbsp;
										
										</th>
										<td>&nbsp;</td>
									</tr>

									
								</table>
								
							</div>
							
					</div>
					
				</div>
			</div>
			<div class="bottomBg">
				<div class="btnWrap">
					<input type="button" onclick="submitForm()" class="subButtonStyle" value="确认"/>
					<input type="button" onclick="closeR3ArtDialog()" class="cancelButtonStyle" value="取消"/>
				</div>
			</div>
		</div>
		</form>
	 </div>
</div>
